﻿namespace Commons.Responses
{
    /// <summary>
    /// 只有一个数据的返回类型
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class DataResponse<T> : MessageResponse where T : new()
    {
        public T Data { get; set; } = new T();

        public DataResponse(T data) : base()
        {
            this.Data = data;
            if(data == null)
            {
                SetFailed();
            }
        }
        public DataResponse(T data, string message) : base(message)
        {
            this.Data = data;
        }

        public DataResponse() : base() { }
        public DataResponse(string message) : base(message) { }
        public DataResponse(int code, string msg, bool isbool) : base(code, msg, isbool) { }

    }
}
